package com.chis.jmdatatimer.comm;

import com.chis.jm.pojo.TdChileditdate;
import com.chis.util.DateTimeUtil;
import org.apache.commons.lang.StringUtils;
import redis.clients.jedis.ShardedJedis;

/**
 * @Description 查询儿童全档案更新时间
 * @Company zwx
 * @author zww1
 * @version 2018年09月14日
 */
public class RedisFindChildEditdateTx implements TransactionJedis {
    /** 儿童编码 */
    private String childCode;
    /** 儿童全档案更新时间 */
    private TdChileditdate chileditdate;

    public RedisFindChildEditdateTx(String childCode) {
        this.childCode = childCode;
    }

    @Override
    public void run(ShardedJedis jedis) throws Exception {
        // 全表更新时间
        jedis.select(9);
        String strDate = jedis.get(childCode);
        if (StringUtils.isBlank(strDate)) {
            return;
        }
        chileditdate = new TdChileditdate();
        chileditdate.setChilCode(Long.parseLong(childCode));
        chileditdate.setChilEditDate(DateTimeUtil.getDateTime(strDate));
    }

    public TdChileditdate getChileditdate() {
        return chileditdate;
    }
}
